const moment = require('moment')
moment.suppressDeprecationWarnings = true;
const sek = require('./sek')
let timer = null
timer = setInterval(() => {
    // console.log(moment().format('HH:mm:ss'));
    request()
}, 1)
const startTime = '2022-3-23 09:00:00' // 开始秒杀的时间
let exprie = moment(startTime).valueOf()
const request = () => {
    let next = exprie - moment().valueOf()
    let h = moment.duration(next)._data.hours
    let m = moment.duration(next)._data.minutes
    let s = moment.duration(next)._data.seconds
    let ms = moment.duration(next)._data.milliseconds
    if (next <= 600) {
        clearInterval(timer)
        sek()
        setTimeout(() => {
            sek()
        }, 150);
    }
    if (next > 0 && next < 15000) {
        console.log(`${h}时${m}分${s}秒${ms}毫秒`)
    }
}
